package com.atguigu.customerdemo.mapper;

import com.atguigu.customerdemo.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * ClassName: CustomerMapper
 * Package: com.atguigu.customerdemo.mapper
 * Description:
 *
 * @Author ChenJun
 * @Create 2023/4/3 16:29
 * @Version 1.0
 */
@DS("mysql1109")
@Mapper
public interface CustomerMapper extends BaseMapper<Customer> {

    //通过mybatis注解查询
    @DS("test_221109")
    @Select("select * from customer where name = #{name}")
    public Customer getCustomerByName(@Param("name") String name);


    @DS("test_221109")
    //利用Mybatis通过注解的方式写入数据
    @Insert("insert into customer (name,age) values(#{name},#{age}) ")
    public void saveCustomerByNameAndAge(@Param("name") String name,@Param("age") String age);



    @DS("test_221109")
    //利用Mybatis通过注解的方式写入数据
    @Insert("insert into customer (name,age) values(#{name},#{age}) ")
    public void insertNameWithAge(@Param("name") String name,@Param("age") String age);



}
